<template>
  <view class="p-2 oubSubmit">
    <view class="bg-white rounded-10 mb-3 p-3">
    	<view class="mb-2">销售合计</view>
		<view class="flex j-start a-center mb-3">
			<view class="label">合计数量</view>
			<view class="inp">
				<u--input type="text" disabled v-model="formData.count" placeholder="请输入" clearable fontSize="12px"></u--input>
			</view>
		</view>
		<view class="flex j-start a-center mb-3">
			<view  class="label">合计退货价</view>
			<view class="inp">
				<u--input type="text" disabled v-model="formData.returnPrice" placeholder="请输入" clearable fontSize="12px"></u--input>
			</view>
			<text>元</text>
		</view>
    </view>
	
	
	<view class="position-fixed left-0 bottom-0 bg-white p-4 w-100">
		<view class="btn m-o col-8 rounded-40 " style="height: 70rpx;" @click="submit">提交</view>
	</view>
  </view>
</template>

<script>
	import {
		salesReturnList,
		editSaleRecord,saleReturnsSubmit
	} from '@/common/api/returns.js'
  export default {
    name: "",
    mixins: [],
    data() {
      return {
		 formData: {
		 	returnPrice:0,
		 	count:0
		 	
		 },
	  }
    },
    onLoad() {
		this.getSalesReturnList()
    },
    watch: {},
    computed: {},
    methods: {
		getSalesReturnList() {
			this.formData.returnPrice=0;
			salesReturnList().then(res => {
				this.listsData = res.data;
				this.formData.count=res.data.length;
				res.data.forEach(i=>{
					this.formData.returnPrice+=Number(i.returnPrice);
				})
			})
		},
		submit(){
			saleReturnsSubmit({
				list:this.listsData,
				saleUserId:this.app_user_info.id
			}).then(res=>{
				uni.$u.toast('提交成功');
				this.navigateBack();
			})
		}
	}
  }
</script>

<style lang="scss">
	.oubSubmit{
		.u-input {
			padding: 8rpx 10rpx !important;
		}
		.label{
			width: 190rpx;
			text-align: right;
			margin-right: 10rpx;
		}
		.inp{
			width: 400rpx;
			margin-right: 10rpx;
		}
	}
</style>